<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="theme/Header.jsp" %>
<script type="text/javascript" >
    $().ready(function() {
        $('#execute').click(function(){
            $('#p').val('1');
            submit();
        });


    });

    function station(autoObj,showObj){
        var mkAutoObj=autoObj;
        var mkSerValObj=showObj;
        new Autocomplete(mkAutoObj, function() {
            this.setValue = function(id) {
                $(mkSerValObj).val(id);
            }
            if ( this.isModified )
                this.setValue("");
            if ( this.value.length < 1 && this.isNotClick )
                return ;
            return "CallALLStations?id=" + this.value;
        });
    }

    function pay(id) {

        var p = $('#p').val();
        var plate = $('#plate').val();
        var documentNo = $('#documentNo').val();
        var station = $('#station').val();
        var station2 = $('#station2').val();
        window.location = "RCP001PayDisplay?id=" + id +
                          "&plate=" + plate +
                          "&documentNo=" + documentNo +
                          "&station=" + station +
                          "&station2=" + station2 +
                          "&p=" + p;
    }

    function submit() {
        $('#frm_rcp001').submit();
    }
</script>
<div id="site-root">
    <div>
        <a href="RCP001">[RCP001- บันทึกการรับชำระเงินรถพลการทั่วไป]</a>
    </div>
</div>

<div id="button-bar">
    <fieldset >
        <div class="buttons">
            <button class="positive" id="execute">
                <img  src="theme/images/icons/search.gif" alt="" width="16" height="16"/>ค้นหาข้อมูล
            </button>
        </div>
    </fieldset>
</div>

<div id="source-data">
    <fieldset style="background: #FFF">
        <legend>รายละเอียดการค้นหา</legend>
        <form action="RCP001Display" id="frm_rcp001" method="post" class="cmxform">
            <table width="100%" cellpadding="1">

                <tr>
                    <td width="150px" align="right">หมายเลขทะเบียน : </td>
                    <td width="350px"><input type="text" id="plate" name="plate" tabindex="1" value="${plate}"/></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>

                <tr>
                    <td align="right">เลขที่เรียกเก็บเงิน : </td>
                    <td><input type="text" id="documentNo" name="documentNo" tabindex="2" value="${documentNo}"/></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>

                <tr>
                    <td align="right">ด่าน : </td>
                    <td>
                        <input type="text" name="station" id="station" tabindex="3"
                               value="${stationName}"/>
                        <input type="hidden" id="station2" name="station2" style="display: none"
                               value="${station}"/>
                    </td>
                </tr>
            </table>
            <input type="hidden" id="p" name="p" value="${p}" />
        </form>
    </fieldset>
</div>

<div id="result-data">
    <c:choose>
        <c:when test="${empty total}">

            <div class="padding-status">
                <fieldset>
                    <div id="result-bar">
                        <table border="0" width="100%">
                            <tr>
                                <td>ผลการค้นหา : 0 รายการ</td>
                                <td width="200px" align="right">หน้าที่ :
                                    <select>
                                        <option value="1" >1</option>
                                    </select>
                                    / 1 </td>
                                <td width="100px">
                                    <img src="theme/images/ar_left_abs_dis.gif" />
                                    <img src="theme/images/ar_left_dis.gif" />
                                    <img src="theme/images/ar_right_dis.gif" />
                                    <img src="theme/images/ar_right_abs_dis.gif" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
            </div>
        </c:when>
    </c:choose>
    <div class="padding-status">${pStatus}</div>
    <table border="0"  cellpadding="4" cellspacing="1">
        <tr style="background: #3B5998;color: #FFF">
            <th width="20px">&nbsp;</th>
            <th width="50px">เลขที่</th>
            <th width="200px">วันที่</th>
            <th width="100px">ด่าน</th>
            <th width="100px">เลขทะเบียน</th>
            <th width="120px">จังหวัด</th>
            <th width="100px">อัตรา</th>
            <th width="100px">ชำระเงิน</th>
            <th width="150px">สถานะ</th>
        </tr>
        <c:choose>
            <c:when test="${empty dataList}">
            </c:when>
            <c:otherwise>

                <c:forEach items="${dataList}" var="result" varStatus="i">
                    <tr id="${i.count}"
                        onmouseover="over('${i.count}');"
                        onmouseout="out('${i.count}','${i.count%2==0?"#FFFFFF":"#EEEFF4"}');"
                        ondblclick="pay('${result.id}');"
                        bgcolor="${i.count%2==0?"#FFFFFF":"#EEEFF4"}">
                        <td>${result.flagImg}</td>
                        <td align="center">${goto + i.count}</td>
                        <td align="center">${result.uapDate}</td>
                        <td align="center">${result.uapExitStationName}</td>
                        <td align="center">${result.plateNo}</td>
                        <td align="center">${result.provinceName}</td>
                        <td align="right">
                            <fmt:formatNumber value="${result.rate}" pattern="#,##0" />
                        </td>
                        <td align="right">
                            <fmt:formatNumber value="${result.pay}" pattern="#,##0" />
                        </td>
                        <td align="center">${result.statusName}</td>
                    </tr>
                </c:forEach>
            </c:otherwise>
        </c:choose>
    </table>
</div>
<br>
<script type="text/javascript">
    station("station","#station2");
</script>
<%@include file="theme/Footer.jsp" %>
